package com.itheima.branch;

public class SwitchDemo2 {
    public static void main(String[] args) {
        //switch语句
        int score = 89;
        switch (score / 10) {
            case 10:
            case 9:
                System.out.println("优秀");
                break;
            case 8:
                System.out.println("良好");
                break;
            case 7:
                System.out.println("中等");
                break;
            default:
                System.out.println("不及格");
                break;
        }

        //周一到周五
        int day = 2;
        switch (day) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                System.out.println("工作日");
                break;
            default:
                System.out.println("休息日");
                break;
        }

        //if,switch语句各自适合的场景
        //if适合做条件判断
        //switch适合做多分支选择
        //switch语句的穿透性
        int month = 1;
        switch (month) {
            case 1:
                System.out.println("一月");
            case 2:
                System.out.println("二月");
            case 3:
                System.out.println("三月");
            default:
                break;
        }
    }
}
